import java.util.*;

public class TestCountLastDigits {
    public static void main(String[] args) {
        int[] list = {9, 29, 44, 103, 2, 52, 12, 12, 76, 35, 20};
        int[] count = new int[10];
        countLastDigits(list, count);

        System.out.println(Arrays.toString(list));   // [9, 29, 44, 103, 2, ...]
        System.out.println(Arrays.toString(count));  // [1, 0, 4, 1, 1, 1, 1, 0, 0, 2]
    }

    public static int[] countLastDigits(int[] list, int[] count) {
        int placeHolder;
        for (int i = 0; i < list.length; i++) {
            placeHolder = list[i] % 10;
            count[placeHolder] += 1;
        }
        return count;
    }
}